package com.cmsky.open.food.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import com.cmsky.open.core.base.*;
import com.cmsky.open.core.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.cmsky.open.food.model.*;
import com.cmsky.open.food.dao.*;
import com.cmsky.open.food.manager.*;
import com.cmsky.open.food.vo.query.*;

/**
 * @author jandyfish email:jandyfish(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


public class FoodOrderItemInfo extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "FoodOrderItemInfo";
	public static final String ALIAS_ID = "编号";
	public static final String ALIAS_ORDER_ID = "订餐号";
	public static final String ALIAS_TIME = "时间";
	public static final String ALIAS_STATE = "状态";
	public static final String ALIAS_DESCRIPTION = "描述";
	
	//date formats
	public static final String FORMAT_TIME = DATE_FORMAT;
	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 编号       db_column: id 
     */	
	
	private java.lang.Integer id;
    /**
     * 订餐号       db_column: order_id 
     */	
	@NotNull 
	private java.lang.Integer orderId;
    /**
     * 时间       db_column: time 
     */	
	@NotNull 
	private java.util.Date time;
    /**
     * 状态       db_column: state 
     */	
	@NotNull 
	private java.lang.Integer state;
    /**
     * 描述       db_column: description 
     */	
	@Length(max=50)
	private java.lang.String description;
	//columns END

	public FoodOrderItemInfo(){
	}

	public FoodOrderItemInfo(
		java.lang.Integer id
	){
		this.id = id;
	}

	public void setId(java.lang.Integer value) {
		this.id = value;
	}
	
	public java.lang.Integer getId() {
		return this.id;
	}
	public void setOrderId(java.lang.Integer value) {
		this.orderId = value;
	}
	
	public java.lang.Integer getOrderId() {
		return this.orderId;
	}
	public String getTimeString() {
		return DateConvertUtils.format(getTime(), FORMAT_TIME);
	}
	public void setTimeString(String value) {
		setTime(DateConvertUtils.parse(value, FORMAT_TIME,java.util.Date.class));
	}
	
	public void setTime(java.util.Date value) {
		this.time = value;
	}
	
	public java.util.Date getTime() {
		return this.time;
	}
	public void setState(java.lang.Integer value) {
		this.state = value;
	}
	
	public java.lang.Integer getState() {
		return this.state;
	}
	public void setDescription(java.lang.String value) {
		this.description = value;
	}
	
	public java.lang.String getDescription() {
		return this.description;
	}
	
	private FoodOrderInfo foodOrderInfo;
	
	public void setFoodOrderInfo(FoodOrderInfo foodOrderInfo){
		this.foodOrderInfo = foodOrderInfo;
	}
	
	public FoodOrderInfo getFoodOrderInfo() {
		return foodOrderInfo;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("OrderId",getOrderId())
			.append("Time",getTime())
			.append("State",getState())
			.append("Description",getDescription())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof FoodOrderItemInfo == false) return false;
		if(this == obj) return true;
		FoodOrderItemInfo other = (FoodOrderItemInfo)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.append(getOrderId(),other.getOrderId())
			.append(getTime(),other.getTime())
			.append(getState(),other.getState())
			.append(getDescription(),other.getDescription())
			.isEquals();
	}
}

